package jrain.fw.script.operator;

import jrain.fw.script.tools.ELException;
import jrain.fw.script.tools.Logger;

//not 操作
public class NotOperator extends UnaryOperator {

	public static final NotOperator SINGLETON = new NotOperator();

	public NotOperator() {
	}

	public String getOperatorSymbol() {
		return "not";
	}

	public Object apply(Object pValue, Object pContext, Logger pLogger) throws ELException {
		// Coerce the value to a boolean
		boolean val = Coercions.coerceToBoolean(pValue, pLogger).booleanValue();
		return PrimitiveObjects.getBoolean(!val);
	}

}
